package com.huanong.service.impl;
/*
 *@Author:anran
 *@Date:2020/12/7
 *@Version 1.0
 */

import com.huanong.mapper.ProductMapper;
import com.huanong.pojo.Product;
import com.huanong.pojo.vo.ProductInsertVo;
import com.huanong.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<Product> query() {
        return productMapper.queryProduct();
    }

    @Override
    public Product queryById(Integer PtId) {
        return productMapper.queryProductById(PtId);
    }

    @Override
    public int add(ProductInsertVo product) {
        product.setPtTime(new Date());
        return productMapper.addProduct(product);
    }

    @Override
    public int delete(Integer PtId) {
        return productMapper.deleteProduct(PtId);
    }

    @Override
    public List<Product> queryByClassifyId(Integer tsId) {
       return  productMapper.queryProductByClassifyId(tsId);
    }

    @Override
    public int update(ProductInsertVo product) {
        product.setPtTime(new Date());
        return productMapper.updateProduct(product);
    }
}
